// 引入mysql
const mysql = require("mysql2/promise");

// 配置MySQL
async function main() {
    const connection = await mysql.createConnection({
        host: 'localhost',
        user: 'nodejs',
        database: 'nodejs',
        password: 't2019213282',
    });

    // 搜索数据库的内容
    const [results] = await connection.query('SELECT * FROM `user`');
    console.log(results);
}

// 调用主函数
main();